<?php
chdir("../..");
$f=fopen("t16cms/php/config.php","w+");

$enc=$_POST['config'];


$enc=str_replace("\'","'",$enc);
$enc=str_replace("\\\"","\"",$enc);


fwrite($f,$enc);
fclose($f);

include ("t16cms/php/config.php");

mysql_connect($dbhost, $dbuser, $dbpasswd);
mysql_query('SET NAMES cp1251');
$query="CREATE TABLE `".$dbprefix."articles` (
  `title` text NOT NULL,
  `short` longtext NOT NULL,
  `long` longtext NOT NULL,
  `author` text NOT NULL,
  `time` text NOT NULL,
  `category` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;";
mysql_db_query($dbname, $query);

$query="CREATE TABLE `".$dbprefix."users` (
  `name` text NOT NULL,
  `password` text NOT NULL,
  `email` text NOT NULL,
  `icq` text NOT NULL,
  `jabber` text NOT NULL,
  `about` longtext NOT NULL,
  `city` text NOT NULL,
  `avatar` text NOT NULL,
  `site` text NOT NULL,
  `access` text NOT NULL,
  `authkey` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;";
mysql_db_query($dbname, $query);

include ("t16cms/install/root.php");

?>